Release 10.1A: OpenEdge Data Management:
SQL Development


Using the INSERT statement

Use the INSERT statement to add new roles to a table.

The INSERT statement uses the following syntax:

Syntax

INSERT INTO [ owner_name.]{table_name|view_name } 
  [ ( column_name [, column_name ] , ... ) ] 
  { VALUES ( value [, value ] , ... ) | query_expression } ; 

Example 6–5 depicts a single row being added to a table.

Example 6–5: INSERT statement
INSERT INTO Customer (CustNum, Name, Address, City, State) 
     VALUES  
         (1001, 'Global Fitness', '10 Columbia Street', 'New York', 'NY') ; 

INSERT statements can also be executed based upon the results of a query expression. In Example 6–6, rows are created in a table of New York customers based on a query of the Customer table.

Example 6–6: INSERT statement based on query expression
INSERT INTO NYCustomer (CustNum, Name) 
SELECT CustNum, Name FROM 
Customer WHERE state = 'NY'; 

Notes: If the optional column list is used, then only the values for those columns in the statement are required. Otherwise, values must be specified or returned by a query expression.

Using VALUES to specify columns will insert one row into the table. Use the query expression to insert multiple rows.

For more information on the INSERT statement, see OpenEdge Data Management: SQL Reference .


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095